package enums;
/*

    This file is part of Logica-Logike.

    Logica-Logike is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation version 3 of the License.

    Logica-Logike is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Logica-Logike.  If not, see <http://www.gnu.org/licenses/>.

 */
/**
 * Enumera el conjunto de operandos que pueden ser usados en una tabla de verdad;
 */
public enum OperandsEnum {
    CONJUNCION, INCOMPATIBILIDAD, DISYUNCION_INCLUSIVA, NEGACION_CONJUNTA, DISYUNCION_EXCLUSIVA, BICONDICIONAL, CONDICIONAL,
    NEGACION;

    /**
     * Este metodo permite obtener el valor de OperandsEnum asociado al valor pasado como parametro;
     *
     * @param operandsValue;
     * @return OperandsEnum;
     */
    public static OperandsEnum getOperand(int operandsValue) {
        switch (operandsValue) {
            case 7:
                return CONJUNCION;
            case 6:
                return INCOMPATIBILIDAD;
            case 5:
                return DISYUNCION_INCLUSIVA;
            case 4:
                return NEGACION_CONJUNTA;
            case 3:
                return DISYUNCION_EXCLUSIVA;
            case 2:
                return BICONDICIONAL;
            case 1:
                return CONDICIONAL;
            case 0:
                return NEGACION;
        }
        return null;
    }

    /**
     * Este metodo permite obtener el valor asociado al valor de OperandsEnum pasado como parametro;
     *
     * @param operandsEnum;
     * @return int valor asociado;
     */
    public static int getOperandsNumber(OperandsEnum operandsEnum) {
        switch (operandsEnum) {
            case CONJUNCION:
                return 7;
            case INCOMPATIBILIDAD:
                return 6;
            case DISYUNCION_INCLUSIVA:
                return 5;
            case NEGACION_CONJUNTA:
                return 4;
            case DISYUNCION_EXCLUSIVA:
                return 3;
            case BICONDICIONAL:
                return 2;
            case CONDICIONAL:
                return 1;
            case NEGACION:
                return 0;
        }
        return 9;
    }
}
